package com.snopy.designPattern.chainOfResponsibility.inter;

/**
 * @author snopy
 * @version 1.0.0
 * @classname Middleware
 * @description
 * @email 77912204@qq.com
 * @date 2022/03/04 13:00
 */
public abstract class Middleware {
    private Middleware next;
    public Middleware linkWith(Middleware next){
        this.next = next;
        return next;
    }
    abstract public boolean check(String username,String password);
    protected boolean checkNext(String username,String password){
        if (next!=null){
            return next.check(username,password);
        }
        return true;
    }

}
